package com.mk.zookeeper.demo.controller;

import com.mk.zookeeper.demo.enent.ZkEnvent;
import org.apache.zookeeper.KeeperException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("event")
public class EnventController {
    @Autowired
    private ZkEnvent zkEnvent;

    @GetMapping("app2")
    public void eventApp2() throws KeeperException, InterruptedException {
//        zkEnvent.getData("/app2");
//        zkEnvent.exists("/app2");
        zkEnvent.addWatch("/app2");
    }
}
